use "$path\datasets\individual_data.dta", clear

drop if rank_gain==.


preserve
keep if female==1
sum rank_gain, det
drop if rank_gain>r(p99) | rank_gain<r(p1)
hist rank_gain,  color(navy) lcolor(black) xtitle(Rank change)   gap(40) frac discrete xlabel(, labsize() angle(horizontal)) ylabel(0(0.05)0.20)
graph export FigureA8/figureA8a.pdf, replace
restore


preserve
keep if female==0
sum rank_gain, det
drop if rank_gain>r(p99) | rank_gain<r(p1)
hist rank_gain,  color(navy) lcolor(black) xtitle(Rank change)   gap(40) frac discrete xlabel(, labsize() angle(horizontal)) ylabel(0(0.05)0.20)
graph export FigureA8/figureA8b.pdf, replace
restore
